#ifndef _BUFFER_H_
#define _BUFFER_H_


#include "../container/queue/Queue.h"

/*
	class : Buffer
	desc : This class provides an easy setup
		for reading and writing data
*/
class Buffer 
{
	public:
		//input queue that gets data to be written
		Queue<unsigned char> input;
		//output queue that holds data that has been read
		Queue<unsigned char> output;
	public: //realistically these functions should be protected
		//gets the input in the queue
		unsigned char getInput();
		//checks if there is any more input
		bool inputEmpty();
		//checks if the output buffer is full and needs to emptied
		bool outputFull();
		//sets adds output data to the output queue
		void setOutput(unsigned char out);
	public ://these are public
		//default constructor 
		Buffer();
		//constructor that sets the input and output queue
		Buffer(Queue<unsigned char>& in, Queue<unsigned char>& out);
		//allocates two fixed size buffers for input and output
		Buffer(unsigned int inSize, unsigned int outSize);
		//provides an interface for reading a byte 
		//must check if there is an output to read first 
		//using empty() though
		unsigned char readByte();
		//reads data of size length and puts into a pointer
		void* read(unsigned int length);
		//writes a byte of data. Should check full if you are 
		//using a queue that is a fixed size.
		void writeByte(unsigned char byte);
		//writes a chunk of data.
		void write(void* data, unsigned int length);
		//returns if the input buffer is full and needs
		//to write data before accepting anymore queries.
		bool full();
		//returns if the output buffer is empty and needs
		//to get new data before returning in read.
		bool empty();
	
};


#endif
